home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / qwik5x.zip / QWIK5X.DOC < prev    next >
Text File  |  1988-12-19  |  81KB  |  2,238 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.                               QWIK SCREEN UTILITIES
  21.                                    USER'S GUIDE
  22.  
  23.                                    Version 5.x
  24.                                 December 20, 1988
  25.  
  26.  
  27.                   Copyright (C) 1988 Eagle Performance Software
  28.                               All Rights Reserved.
  29.  
  30.  
  31.  
  32.                                _______                     
  33.                           ____| _     |               (tm) 
  34.                        --|       |    |------------------- 
  35.                          |   ____|__  |  Association of    
  36.                          |  |       |_|  Shareware         
  37.                          |__|   o   |    Professionals     
  38.                        -----|   |   |--------------------- 
  39.                             |___|___|    MEMBER            
  40.  
  41.  
  42.    QWIK Screen Utilities                             User's Guide, Version 5.x
  43.  
  44.  
  45.  
  46.                        T A B L E   O F   C O N T E N T S
  47.  
  48.         1. INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . 3
  49.              Features .  . . . . . . . . . . . . . . . . . . . . . 3
  50.              Using the Manuals . . . . . . . . . . . . . . . . . . 3
  51.              Licensing . . . . . . . . . . . . . . . . . . . . . . 4
  52.              Customer Service  . . . . . . . . . . . . . . . . . . 4
  53.              ASP . . . . . . . . . . . . . . . . . . . . . . . . . 5
  54.  
  55.         2. GETTING STARTED . . . . . . . . . . . . . . . . . . . . 6
  56.              Distribution Files  . . . . . . . . . . . . . . . . . 6
  57.              Demonstration . . . . . . . . . . . . . . . . . . . . 6
  58.              Simple Programming  . . . . . . . . . . . . . . . . . 6
  59.              Procedures and Functions  . . . . . . . . . . . . . . 8
  60.  
  61.         3. BASIC TECHNIQUES  . . . . . . . . . . . . . . . . . . . 11
  62.              Number to String Conversion . . . . . . . . . . . . . 11
  63.              Cursor Mode Routines  . . . . . . . . . . . . . . . . 11
  64.              Cursor Location Routines  . . . . . . . . . . . . . . 13
  65.              EOS Marker  . . . . . . . . . . . . . . . . . . . . . 13
  66.              Scrolling . . . . . . . . . . . . . . . . . . . . . . 14
  67.              Pop-Up Windows  . . . . . . . . . . . . . . . . . . . 15
  68.  
  69.         4. ADVANCED TECHNIQUES . . . . . . . . . . . . . . . . . . 17
  70.              Virtual Screens . . . . . . . . . . . . . . . . . . . 17
  71.              Video Pages . . . . . . . . . . . . . . . . . . . . . 18
  72.              Video Modes . . . . . . . . . . . . . . . . . . . . . 19
  73.              Multi-tasking Environments  . . . . . . . . . . . . . 20
  74.              Interrupts  . . . . . . . . . . . . . . . . . . . . . 20
  75.  
  76.         5. HARDWARE DETECTION  . . . . . . . . . . . . . . . . . . 21
  77.              Display Combination Code  . . . . . . . . . . . . . . 21
  78.              Snow Checking . . . . . . . . . . . . . . . . . . . . 22
  79.              System Hardware . . . . . . . . . . . . . . . . . . . 23
  80.              Tips  . . . . . . . . . . . . . . . . . . . . . . . . 23
  81.  
  82.         APPENDIX A: Video Mode Table . . . . . . . . . . . . . . . 24
  83.  
  84.         APPENDIX B: Cursor Mode Data . . . . . . . . . . . . . . . 26
  85.              Cursor Mode Tables  . . . . . . . . . . . . . . . . . 26
  86.              Cursor Emulation  . . . . . . . . . . . . . . . . . . 26
  87.  
  88.         APPENDIX C: Performance  . . . . . . . . . . . . . . . . . 29
  89.              Code Size . . . . . . . . . . . . . . . . . . . . . . 29
  90.              Speed . . . . . . . . . . . . . . . . . . . . . . . . 29
  91.              TP4 Usage . . . . . . . . . . . . . . . . . . . . . . 30
  92.  
  93.         APPENDIX D: Application Products . . . . . . . . . . . . . 31
  94.  
  95.         APPENDIX E: Revision History . . . . . . . . . . . . . . . 34
  96.  
  97.         APPENDIX F: References and Credits . . . . . . . . . . . . 37
  98.  
  99.  
  100.  
  101.  
  102.                                        2
  103.    QWIK Screen Utilities                             User's Guide, Version 5.x
  104.  
  105.  
  106.    1.  I N T R O D U C T I O N
  107.  
  108.  
  109.    FEATURES
  110.  
  111.    Welcome to QWIK Screen Utilities!  
  112.  
  113.    You have just obtained a copy of the highest performance screen writing 
  114.    tools available today for Turbo Pascal 5.0 (TP5).  Both novice and 
  115.    professional programmers will appreciate these simple and very powerful 
  116.    utilities that gives you absolute control over your CRT displays in all 
  117.    text modes.
  118.    
  119.    Here are some of the features you will discover:
  120.  
  121.      . Writes on all IBM compatible computers, displays and 
  122.        adapters including the new PS/2 systems and Hercules.
  123.      . Superior video detection routine.
  124.      . Eliminates snow and flicker.
  125.      . Writes directly to the screen in absolute coordinates.
  126.      . Writes in all text modes and column modes.
  127.      . Writes on all video pages.
  128.      . Writes on virtual screens in RAM.
  129.      . Writes text and attribute, text only, or attribute only.
  130.      . Reads strings, characters and attributes.
  131.      . Uses End-Of-String (EOS) marker for quick string chaining.
  132.      . Provides standardized cursor control for all adapters.
  133.      . Enhanced cursor movement.
  134.      . 650% faster than TP5 direct screen writing.
  135.      . Only 2.7k bytes of code if all 43 utilities are used.
  136.      . Optimized by the compiler and drops unused code.
  137.      . Used in all other Eagle products.
  138.  
  139.    QWIK is an enhancement unit providing capabilities not offered in the CRT 
  140.    unit that came with TP5.  In contrast to the CRT unit which does window 
  141.    relative writing, QWIK knows how to write directly to the screen in 
  142.    absolute screen coordinates for any video configuration.
  143.  
  144. |  Version 5X - This version is simply a TP5 compiled version of QWIK42B.  
  145. |  QWIK50 will be out at a later date with other features specific to TP5.
  146.  
  147.  
  148.    USING THE MANUALS
  149.  
  150.    Disk Based Guides - The manuals for QWIK are on disk so that you can 
  151.    conveniently scan for the topic you are seeking.  You can do this with any 
  152.    list or search utility with a search function.  You can also make a printed 
  153.    copy.  If you have not already printed this manual, refer to the READ.ME 
  154.    file for instructions.  At the present time, no bound manuals are being 
  155.    offered with registration.
  156.  
  157.    User's Guide - This manual, the one your are reading now, assumes that as a 
  158.    programmer you are already familiar with Turbo Pascal 4.0.  And that you 
  159.    have a working knowledge of your disk operating system (DOS).  It will 
  160.    provide you the basic principles of direct screen writing and powerful tips 
  161.  
  162.  
  163.    Chapter 1, Introduction                                             Page 3
  164.    QWIK Screen Utilities                             User's Guide, Version 5.x
  165.  
  166.  
  167.    on some previously unavailable techniques.
  168.  
  169.    Reference Guide - This manual describes in detail all procedures, functions 
  170.    and variables used in QWIK.  It is a alphabetically arranged for easy 
  171.    access in a format similar to the TP5 manual.  Use this manual when you 
  172.    have become familiar with the basic principles in the User's guide.
  173.  
  174.  
  175.    LICENSING
  176.  
  177.    Registration - These utilities and the documentation have been released for 
  178.    distribution as Shareware.  You have been given the chance to sample the 
  179.    full capability of QWIK without risk!  If you find that QWIK is a valuable 
  180.    tool, then you are expected to register.  You will find a reasonable 
  181.    licensing schedule found in LICENSE.ARC to meet private or commercial 
  182.    needs.  When registering, be sure to specify the version for Turbo Pascal 
  183.    (such as TP4 or TP5) you wish to receive.
  184.  
  185.    Source Code - All registered users will receive source code when the signed 
  186.    license agreement is returned with the registration.
  187.  
  188.  
  189.    CUSTOMER SERVICE
  190.  
  191.    If you have questions, comments, or suggestions, the Eagle can be contacted 
  192.    by three means - (1) CompuServe, (2) telephone, (3) The Eagle BBS, or 
  193.    (4) mail.
  194.  
  195.    CompuServe - The most dependable way to contact the Eagle is through 
  196.    CompuServe.  James (Jim) H. LeMay has written the TP5 version of QWIK.  He 
  197.    can be contacted on the Borland Forum by typing GO BPROGA from the 
  198.    CompuServe main menu.  You will enter the Forum for Turbo Pascal.  You can 
  199.    contact Jim with his PPN number of 76011,217.  Messages can also be left 
  200.    through EasyPlex.
  201.  
  202.    Telephone - Jim can also be reached by phone at (817) 735-4833 on weekdays 
  203.    and Saturday from 9:00 a.m. to 8:00 p.m CST.
  204.  
  205.    The Eagle BBS - After 01-10-89, you can also contact us on our 24-hour BBS 
  206.    at (214) 539-9878, 1200 N81.
  207.  
  208.    Mail - For registration or problems, please write:
  209.  
  210.        Eagle Performance Software
  211.        TP products
  212.        P.O. Box 122237
  213.        Ft. Worth, TX  76121-2237
  214.  
  215.    In your written request for resolving problems, be sure to include:
  216.  
  217.      . A 5 1/4 inch diskette of compilable source code of the problem.
  218.      . The Eagle product and version number.
  219.      . The computer make and model.
  220.      . The type of video card, video monitor and keyboard.
  221.  
  222.  
  223.  
  224.    Chapter 1, Introduction                                             Page 4
  225.    QWIK Screen Utilities                             User's Guide, Version 5.x
  226.  
  227.  
  228.    For identical Turbo C products, write:
  229.  
  230.        Eagle Performance Software
  231.        TC products
  232.        P.O. Box 292786
  233.        Lewisville, TX  75029-2786
  234.  
  235.    Or, contact Jim Gallagher at (214)-539-7855
  236.  
  237.    ASP
  238.  
  239.    QWIK is a Shareware program conforming to the standards of the Association 
  240.    of Shareware Professionals (ASP).  You can get more information about ASP 
  241.    by writing to:
  242.     
  243.      Association of Shareware Professionals
  244.      325 118th Ave. S.E., Suite 200
  245.      Bellevue, WA  98005.
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.    Chapter 1, Introduction                                             Page 5
  286.    QWIK Screen Utilities                             User's Guide, Version 5.x
  287.  
  288.  
  289.    2.  G E T T I N G   S T A R T E D
  290.  
  291.    This section will acquaint you with the files on disk and show you a 
  292.    brief demonstration.  You will also run your first program with QWIK and 
  293.    then become familiar with all of the utilities.
  294.  
  295.  
  296.    DISTRIBUTION FILES
  297.  
  298.    In this version, QWIK5X.ARC contains:
  299.  
  300.      Qwik5x  .tpu:  Compiled unit of 2000 lines of assembly for TP5.
  301.      Qwik5x  .pas:  Source code for QWIK5X.TPU.  (MASM source code 
  302.                     and object files are not included.)
  303.      Qwik5x  .doc:  This document - a user's guide to QWIK.
  304.      QwikDemo.pas:  A demonstration program showing the features and 
  305.                     speed of all procedures and is written primarily 
  306.                     for color cards, but also works on mono cards.
  307.      QwikRef .doc:  QWIK Reference Guide document covering each 
  308.                     procedure and variable in detail.
  309.      Qinitest.pas:  A program that verifies the equipment detected by 
  310.                     the Qinit procedure.
  311.      Qbench  .pas:  A timing program that shows "screens/second" for 
  312.                     typical QWIK procedures.
  313.      Strs    .pas:  Supplementary unit for number to string 
  314.                     conversions.
  315.      TimerD12.inc:  Include file to measure elapsed time.
  316.      License .arc:  ARC file containing license agreements.
  317.  
  318.  
  319.    DEMONSTRATION
  320.  
  321.    To get an overview of the speed and features of QWIK, let's run a 
  322.    demonstration program that came with the utilities.  Do the following 
  323.    steps.
  324.  
  325.      1. Copy QWIK5X.TPU to QWIK.TPU for TP5.
  326.      2. Make, compile and run QWIKDEMO.PAS to get a feel for 
  327.         features and speed.  
  328.      3. Press return when the screen prompts you to continue with 
  329.         "... press any key".
  330.      4. Before running QINITEST.PAS, read the source code header 
  331.         to see if you want to test for a computer submodel ID.
  332.  
  333.  
  334.    SIMPLE PROGRAMMING
  335.  
  336.    First Program - Let's write a short program to see how simple it is to 
  337.    write with QWIK.  While in the TP editor, enter the following code:
  338.  
  339.      uses Crt,Qwik;
  340.      begin
  341.        TextAttr := Yellow+BlackBG;
  342.        ClrScr;
  343.        Qwrite (5, 1,Yellow+BlueBG,'QWIK writing');
  344.  
  345.  
  346.    Chapter 2, Getting Started                                          Page 6
  347.    QWIK Screen Utilities                             User's Guide, Version 5.x
  348.  
  349.  
  350.        Qwrite (5,13,Yellow+BlueBG,' is easy!');
  351.      end.
  352.  
  353.    Assuming you have already copied QWIK5X.TPU to QWIK.TPU, compile and run 
  354.    the code.  You can then see the text "QWIK writing is easy!" starting on 
  355.    row 5, column 1.  On color monitors, the text is a yellow foreground with a 
  356.    blue background while monochrome monitors show high intensity on black.
  357.  
  358.    Row/Col vs. X/Y - You probably noticed that the row parameter is first and 
  359.    the column parameter is second.  Since QWIK is entirely for text modes, it 
  360.    is more intuitive to specify the row first and the column second just like 
  361.    any word processor.  The X/Y scheme is better suited for graphics.
  362.  
  363.    Attributes - Notice that our example uses the constant "BlueBG".  QWIK 
  364.    provides eight convenient background color constants to use along with 
  365.    Turbo's 16 foreground colors.  The same names are used, but the "BG" suffix 
  366.    is added: 
  367.  
  368.       BlackBG       RedBG
  369.       BlueBG        MagentaBG
  370.       GreenBG       BrownBG
  371.       CyanBG        LightGrayBG
  372.  
  373.    These allow QWIK to make the most of Turbo's constant folding.  By simply 
  374.    adding the foreground and background constants together, the compiler saves 
  375.    the result as a single word.  And, by simply reading the Qwrite statement, 
  376.    what you see is what you get (WYSIWYG). 
  377.  
  378.    Readable Code - As an added benefit, QWIK was designed with human factors 
  379.    in mind and was made so that it is very easy to read the code you create.  
  380.    With the row, column, and attribute parameters first and the string last, 
  381.    you can see that the two Qwrite statements were easily aligned.  WYSIWYG to 
  382.    the rescue again!
  383.  
  384.    Chaining - Notice that we had to calculate the string length of "QWIK 
  385.    writing" before we could locate the string " is easy".  Let's modify the 
  386.    last statement to indeed make it easier to locate the last string:
  387.  
  388.      uses Crt,Qwik;
  389.      begin
  390.        TextAttr := Yellow+BlackBG;
  391.        ClrScr;
  392.        Qwrite (5, 1,Yellow+BlueBG,'QWIK writing');
  393.        QwriteEos   (Yellow+BlueBG,' is easy!');
  394.      end.
  395.  
  396.    Now that was really easy!  How did QwriteEos know where to write?  QWIK 
  397.    internally keeps track of an End-Of-String (EOS) marker so that any 
  398.    subsequent "Eos" procedure like QwriteEos will chain the next string right 
  399.    there - no rows or columns to calculate!  And you can chain as many as you 
  400.    want on to any other QWIK procedure.
  401.  
  402.    Same Attribute - But suppose we did not want to change the attribute that 
  403.    was already on the screen and don't even know what it is.  How is that 
  404.    done?  Just modify the attributes to the following:
  405.  
  406.  
  407.    Chapter 2, Getting Started                                          Page 7
  408.    QWIK Screen Utilities                             User's Guide, Version 5.x
  409.  
  410.  
  411.  
  412.      uses Crt,Qwik;
  413.      begin
  414.        TextAttr := LightGray+BlackBG;
  415.        ClrScr;
  416.        Qwrite (5, 1,SameAttr,'QWIK writing');
  417.        QwriteEos   (SameAttr,' is easy!');
  418.      end.
  419.  
  420.    The special constant SameAttr (which is negative) tells QWIK to simply 
  421.    enter the text on the screen without changing the attribute.  The result of 
  422.    the program would show the text with LightGray on Black attributes.  This    
  423.    special constant works on all QWIK utilities.  When assigned to a variable, 
  424.    the attribute can even be switched at run time.
  425.  
  426.    Centering - Rather than having the text left justified, let's center the 
  427.    text on the screen by modifying a portion of the code:
  428.  
  429.      ...
  430.        ClrScr;
  431.        QwriteC (5, 1,80,SameAttr,'QWIK writing is easy!');
  432.      end.
  433.  
  434.    This will place the text on row 5 centered between columns 1 and 80 which 
  435.    is perfect for an 80 column text mode.  But what if other text or column 
  436.    modes are used?  How can we ensure that it is always centered?  Only one 
  437.    simple change is needed:
  438.  
  439.      ...
  440.        ClrScr;
  441.        QwriteC (5, 1,CRTcols,SameAttr,'QWIK writing is easy!');
  442.      end.
  443.  
  444.    The variable CRTcols always has the value of the column width that is 
  445.    currently being used.  How does it know?  QWIK is initialized at startup by 
  446.    executing a procedure called Qinit.  It detects a host of information about 
  447.    your video configuration, everything from the type of video card you are 
  448.    using to the shape of the cursor being used.  You can see a list of all 
  449.    these variables available for your use in QWIKREF.DOC.
  450.  
  451.  
  452.    PROCEDURES AND FUNCTIONS
  453.  
  454.    Now that you have a basic idea of what QWIK can do, let's make a brief 
  455.    survey of all the utilities in QWIK.TPU to just know what is available:
  456.  
  457.      One initializing procedure:
  458.  
  459.          Qinit       - Initializing procedure executed by QWIK5X.TPU which 
  460.                        sets the global variables for the QWIK procedures.  
  461.                        It should be executed again after a change from one 
  462.                        text mode to another.
  463.  
  464.      Three quick direct screen writing procedures, all work with or 
  465.      without attribute change:
  466.  
  467.  
  468.    Chapter 2, Getting Started                                          Page 8
  469.    QWIK Screen Utilities                             User's Guide, Version 5.x
  470.  
  471.  
  472.  
  473.          Qwrite      - For any type string or character (char).
  474.          QwriteC     - For any type string or char; self-centering.
  475.          QwriteA     - For any type variable, arrays or substrings. 
  476.  
  477.      Four quick direct screen filling procedures in Rows-by-Cols block 
  478.      parameters:
  479.  
  480.         Qfill        - Repetitive filling with the same character; with or
  481.                        without attribute change.
  482.         QfillC       - Same as Qfill, but self-centering.
  483.         Qattr        - Repetitive filling with an attribute only.
  484.         QattrC       - Same as Qattr, but self-centering. 
  485.  
  486.      Two quick screen storing procedures:
  487.  
  488.         QstoreToMem  - Saves a Rows-by-Cols block to memory.
  489.         QstoreToScr  - Restores a Rows-by-Cols block to any screen page.
  490.  
  491.      Two quick screen storing procedures for copying blocks between a 
  492.      screen (Scr) and a virtual screen (Vscr - a screen in memory):
  493.  
  494.         QScrToVscr   - Copies a Rows-by-Cols block from QWIK screen to 
  495.                        virtual screen.
  496.         QVscrToScr   - Restores a Rows-by-Cols block from a virtual screen 
  497.                        to the QWIK screen.
  498.  
  499.      Three quick screen reading functions for reading data from any 
  500.      screen:
  501.  
  502.          QreadStr    - Reads a string of text.
  503.          QreadChar   - Reads a single character.
  504.          QreadAttr   - Reads an attribute.
  505.  
  506.      Two quick scrolling procedures work on any video page and also  
  507.      virtual screens without flicker or snow:
  508.  
  509.          QscrollUp   - Scroll affected rows-by-cols block up.
  510.          QscrollDown - Scroll affected rows-by-cols block down.
  511.  
  512.      Two quick video page changing procedures:
  513.  
  514.          QviewPage   - Changes the page to be displayed - up to 8!
  515.          QwritePage  - Sets the page on which the QWIK procedures are 
  516.                        writing.  You don't have to write just on the 
  517.                        displayed page!
  518.  
  519.      Three quick cursor procedures and functions which work on any video 
  520.      page.  They now work on the page being written rather than viewed:
  521.  
  522.          GotoRC      - Move cursor to absolute row and column coordinates 
  523.                        rather than relative to a window.
  524.          WhereR      - Returns absolute cursor row.
  525.          WhereC      - Returns absolute cursor column. 
  526.  
  527.  
  528.  
  529.    Chapter 2, Getting Started                                          Page 9
  530.    QWIK Screen Utilities                             User's Guide, Version 5.x
  531.  
  532.  
  533.      Eight quick EOS (End-Of-String) marker procedures and functions that 
  534.      alter its position and/or the cursor.  The marker can be moved on the 
  535.      CRT and virtual screens, while the cursor movement is only on the 
  536.      page being written:
  537.  
  538.           GotoEos      - Moves cursor to EOS marker (like TP write).
  539.           EosR         - Returns absolute row of EOS marker.
  540.           EosC         - Returns absolute col of EOS marker.
  541.           EosToRC      - Sets EOS to a given row and column.
  542.           EosToRCrel   - Relatively shifts EOS by a number of rows and 
  543.                          columns, and can be negative or positive.
  544.           EosToCursor  - Matches EOS to the cursor position.
  545.           EosLn        - Moves EOS to column 1 of the next row.
  546.           QEosLn       - Like EosLn, but scrolls up if past last row.
  547.  
  548.      Three cursor routines alter the cursor mode:
  549.  
  550.          GetCursor    - Get current cursor mode from low memory.
  551.          SetCursor    - Sets new cursor mode. 
  552.          ModCursor    - Modifies cursor mode to on, off or erratic
  553.                         blink saving current scan lines.
  554.  
  555.      Four quick EOS writing procedures that chain write at the EOS marker: 
  556.  
  557.          QwriteEos    - like Qwrite.
  558.          QwriteEosA   - like QwriteA.
  559.          QfillEos     - like Qfill.
  560.          QattrEos     - like Qattr.
  561.  
  562.      A Submodel identification routine:
  563.  
  564.          GetSubModelID - Optional procedure to find IBM submodel ID.
  565.  
  566.      Five string functions that convert integers and reals to strings by 
  567.      using the supplementary STRS unit:
  568.  
  569.          StrL   - converts LongInt to string
  570.          StrLF  - converts LongInt to string in a fixed Field
  571.          StrR   - converts Real to string
  572.          StrRF  - converts Real to string in a fixed Field
  573.          StrRFD - converts Real to string in a fixed Field with a 
  574.                   specified number of Decimals
  575.  
  576.    For a full description of each utility with its parameters, please refer to 
  577.    QWIKREF.DOC for a summary of details and examples.
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.    Chapter 2, Getting Started                                          Page 10
  591.    QWIK Screen Utilities                             User's Guide, Version 5.x
  592.  
  593.  
  594.    3.  B A S I C   T E C H N I Q U E S
  595.  
  596.  
  597.    NUMBER TO STRING CONVERSION
  598.  
  599.    Str Procedure - TP5 handily converts numbers into strings with the Str 
  600.    procedure.  For example:
  601.  
  602.      var MyNumber: integer;
  603.          MyString: string;
  604.      begin
  605.        Str (MyNumber:7,MyString);
  606.        Qwrite ( 1, 1,SameAttr,MyString);
  607.      end.
  608.  
  609.    But this means that a data area must be reserved and the code isn't as 
  610.    readable as it could be.
  611.  
  612.    Str Functions - Instead, QWIK and the supplementary STRS unit let you use a 
  613.    function form of Str:
  614.  
  615.      uses Qwik, Strs;
  616.      var MyNumber: integer;
  617.      begin
  618.        Qwrite ( 1, 1,SameAttr,StrLF(MyNumber,7));
  619.      end.
  620.  
  621.    Just like WriteLn, this lets the number remain in the Qwrite statement.  
  622.    There are five functions in the STRS unit and they can be used just like 
  623.    any other function:
  624.  
  625.      StrL   - converts LongInt to string
  626.      StrLF  - converts LongInt to string in a fixed Field
  627.      StrR   - converts Real to string
  628.      StrRF  - converts Real to string in a fixed Field
  629.      StrRFD - converts Real to string in a fixed Field with a specified 
  630.               number of Decimals
  631.  
  632.    The suffixes mean:
  633.  
  634.      L - LongInt, but any scalar will work
  635.      R - Real
  636.      F - Field width that is right justified format
  637.      D - Number of decimals in the format
  638.  
  639.    The Str* functions actually use the Str procedure from TP5 to do the 
  640.    conversion.  But with an InLine code trick, functions were created that 
  641.    don't recopy the string for the greatest speed.  The code useage is 
  642.    also reduced.
  643.  
  644.  
  645.    CURSOR MODE ROUTINES
  646.  
  647.    Three Routines - If you have ever struggled with controlling the shape of 
  648.    the cursor, your life is about to be made easier.  With just three 
  649.  
  650.  
  651.    Chapter 3, Basic Techniques                                         Page 11
  652.    QWIK Screen Utilities                             User's Guide, Version 5.x
  653.  
  654.  
  655.    routines, SetCursor, GetCursor, and ModCursor, you can consistently and 
  656.    reliably control the cursor mode (shape and visibility) on any video card!
  657.  
  658.    Four Standard Modes - To make it even easier, four standard cursor mode 
  659.    variables are initialized at startup to fit the exact requirements of the 
  660.    detected video card.  They are:
  661.  
  662.      CursorUnderline - The standard underline cursor.
  663.      CursorHalfBlock - The half block shape usually used for insert 
  664.                        editing.
  665.      CursorBlock     - An easy to find full cell cursor.
  666.      CursorInitial   - The mode detected at start up.
  667.  
  668.    So, if we wanted a full block cursor, only one line of code is needed:
  669.  
  670.      SetCursor (CursorBlock);
  671.  
  672.    And that's it!  There's nothing else to figure out - even if you are using 
  673.    something like 43-row mode on an EGA card.  When ending your programs, you 
  674.    can get back to the original cursor mode by using:
  675.  
  676.      SetCursor (CursorInitial);
  677.  
  678.    Hidden Cursor - Many programs need to hide the cursor altogether.  This can 
  679.    be done with ModCursor:
  680.  
  681.      ModCursor (CursorOff);
  682.  
  683.    Why use ModCursor instead of SetCursor?  ModCursor leaves the shape of the 
  684.    cursor alone, and only alters bits 13 and 14 of the cursor mode to turn it 
  685.    on or off.  In fact there are three constants that are useful with 
  686.    ModCursor:
  687.  
  688.      CursorOff   ($2000) - To turn the cursor off.
  689.      CursorOn    ($0000) - To turn the cursor back on with the same shape.
  690.      CursorBlink ($6000) - To create erratic blinking on MDA/CGA.  (On 
  691.                            EGA/VGA, it turns the cursor off.)
  692.  
  693.    Using your imagination, you can also mix and match the constants and 
  694.    variables by logically summing them.  Let's say we want to change the shape 
  695.    of the cursor to a block while it is still turned off:
  696.  
  697.      SetCursor (CursorBlock or CursorOff);
  698.  
  699.    So, the next time ModCursor(CursorOn) is used, the cursor will be a full 
  700.    block.  As a suggestion for terminating your program, be sure to restore 
  701.    the cursor in your exit procedure with: 
  702.  
  703.      SetCursor (CursorInitial);
  704.  
  705.    GetCursor - This function simply returns the current cursor mode value 
  706.    stored in low memory allowing you to save it for later use.
  707.  
  708.  
  709.  
  710.  
  711.  
  712.    Chapter 3, Basic Techniques                                         Page 12
  713.    QWIK Screen Utilities                             User's Guide, Version 5.x
  714.  
  715.  
  716.    CURSOR LOCATION ROUTINES
  717.  
  718.    QWIK has three routines that complement the CRT unit - GotoRC, WhereR, and 
  719.    WhereC.  They correspond with the familiar GotoXY, WhereX, and WhereY.  
  720.    However, there are some important differences: 
  721.  
  722.      . The QWIK routines are absolute to the screen and are not restricted 
  723.        by the Turbo window.
  724.      . The suffixes "R" and "C" mean row and column, so the parameters of      
  725.        GotoRC are reversed from GotoXY.
  726.      . The QWIK routines will also work on any video page.  This is 
  727.        explained in the Advanced Techniques section later.
  728.  
  729.    This is not the only way to move the cursor.  The EOS marker is also a very 
  730.    powerful aid as you will see in the next topic.
  731.  
  732.  
  733.    EOS MARKER
  734.  
  735.    Invisible Alternate Cursor - From the examples in the Simple Programming 
  736.    topic, we found that we could easily chain two strings together using the 
  737.    EOS marker.  In fact, this marker is so versatile, the EOS marker utilities 
  738.    can be made interchangeable with the cursor, but much faster.  You could 
  739.    think of it as an alternate cursor that is invisible.
  740.  
  741.    Keeping Track - Any time a QWIK writing procedure is used, the EOS marker 
  742.    is updated.  It is actually saved as the global variable QEosOfs.  
  743.    Technically, the value is the offset from the screen base and is a 0-based 
  744.    byte count.  For example, if the following procedure was executed:
  745.  
  746.      Qwrite (6,5,Yellow,'Important Data');
  747.  
  748.    the EOS would be at row 6, column 19, right after the word "Data".  The 
  749.    value of QEosOfs on an 80 column screen would be:
  750.  
  751.      QEosOfs = ((Row-1)*CRTcols + (Col-1)) * 2 = 836
  752.  
  753.    QWIK does not need to calculate this value, but simply saves it after 
  754.    writing, so it is very efficient.  From the overview, you are already aware 
  755.    of the four routines that will start writing at this marker - QwriteEos, 
  756.    QwriteEosA, QfillEos, and QattrEos.  But what about changing the location 
  757.    of the marker itself?  Keep reading.
  758.  
  759.    Moving the Marker - QWIK has four routines that will manually move the EOS 
  760.    marker:
  761.  
  762.      EosToRC      - Sets EOS to a given row and column.
  763.      EosToRCrel   - Relatively shifts EOS by a number of rows and 
  764.                     columns, and can be negative or positive.
  765.      EosLn        - Moves EOS to column 1 of the next row.
  766.      QEosLn       - Like EosLn, but scrolls up if past last row.
  767.  
  768.    The basic procedure EosToRC moves the EOS marker exactly like GotoRC does 
  769.    for the cursor.  But there are also several ways to move the marker 
  770.    relatively.  Let's test a short program:
  771.  
  772.  
  773.    Chapter 3, Basic Techniques                                         Page 13
  774.    QWIK Screen Utilities                             User's Guide, Version 5.x
  775.  
  776.  
  777.  
  778.      uses Crt,Qwik;
  779.      begin
  780.        TextAttr := Yellow;
  781.        ClrScr;
  782.        Qwrite     ( 1, 1,Yellow+BlueBG,'First  Row ');
  783.        EosLn;                                           { Jump to (2,1) }
  784.        QwriteEos        (Yellow+BlueBG,'Second Row ');
  785.        EosToRC    ( 3, 1);                              { Jump to (3,1) }
  786.        QwriteEos        (Yellow+BlueBG,'Third  Row ');
  787.        EosToRCrel ( 1,-4);                              { Jump to (4,8) }
  788.        QwriteEos        (Yellow+BlueBG,       'etc.');
  789.        EosToRC    (succ(EosR),8);                       { Jump to (5,8) }
  790.        QwriteEos        (Yellow+BlueBG,       'etc.');
  791.      end.
  792.  
  793.    Compile and run the program.  You should see "Row" and "etc." all aligned 
  794.    in one column.  So, you can see that there are several simple ways to move 
  795.    the marker!
  796.  
  797.    EOS and the Cursor - You can also interface the EOS marker and the cursor 
  798.    with two procedures:
  799.  
  800.      GotoEos      - Moves cursor to match the EOS marker.
  801.      EosToCursor  - Sets the EOS marker to match the cursor position.
  802.  
  803.    It can't get any simpler than that!  Now you can see that:
  804.  
  805.      Qwrite (1,1,Yellow,'Test Line');
  806.      GotoEos;
  807.  
  808.    and,
  809.      
  810.      TextAttr := Yellow;
  811.      GotoXY (1,1);
  812.      Write ('Test Line');
  813.  
  814.    produce identical results.  But QWIK is much faster!
  815.  
  816.  
  817.    SCROLLING
  818.  
  819.    Improved Control - With the CRT unit, you can only control the full screen 
  820.    size with WriteLn.  But with the two QWIK routines, QscrollUp and 
  821.    QscrollDown, you can define any area to be scrolled: 
  822.  
  823.       QscrollUp ( 2, 2,CRTrows-2,CRTcols-2,MyAttr);
  824.  
  825.    This example scrolls a portion of the screen starting at (2,2) leaving a 
  826.    one character border.  In a 25x80 text mode, it clears row 24 from column 2 
  827.    to 79.  In addition, the cleared row attribute is MyAttr.
  828.  
  829.    Improved Performance - With QscrollDown and QscrollUp (called Qscroll* for 
  830.    brevity), your programs can overcome the BIOS problems on many machines.   
  831.    Transparent to you, these procedures work on all cards and machines without 
  832.  
  833.  
  834.    Chapter 3, Basic Techniques                                         Page 14
  835.    QWIK Screen Utilities                             User's Guide, Version 5.x
  836.  
  837.  
  838.    flicker or snow and operate at three speeds: 
  839.  
  840.      Maximum  - for video cards without snow
  841.      Fast CGA - for CGA cards on 80286 machines or better
  842.      Slow CGA - for CGA cards on 8086/8088 machines
  843.  
  844.    Qinit detects the CPU ID and video card to select the fastest algorithm.  
  845.    All speeds use 16-bit transfers rather than 8-bit.  So, you can be assured 
  846.    of the highest performance.
  847.  
  848.    Cursor Location - These routines do not move the cursor.  However, EOS is 
  849.    pointing to the first column of the blank line and GotoEos will move the 
  850.    cursor there if needed.
  851.  
  852.    QEosLn - This procedure is another alternative to full screen scrolling.  
  853.    It has the same function as EosLn, but will additionally scroll the screen 
  854.    up if the EOS marker is past the last row.  Then it simply calls QscrollUp.  
  855.    The attribute of the cleared row is the global variable ScrollAttr.  You 
  856.    must set this prior to using QEosLn.
  857.  
  858.  
  859.    POP-UP WINDOWS
  860.  
  861.    QWIK has the basic tools to create and remove pop-up windows.  Let's try to 
  862.    create one.  While in the TP editor, enter the following code:
  863.  
  864.      uses Crt,Qwik;
  865.      var 
  866.        MyWindow,MyUnderlay: array[1..250] of word;
  867.      begin
  868.        { -- Fill the screen with a hatch character. -- }
  869.        Qfill ( 1, 1,CRTrows,CRTcols,LightGray+BlackBG,#176);  
  870.        { -- Create a pop-up window.-- }
  871.        QstoreToMem ( 5,12,10,25,MyUnderlay);  { Save area to be covered }
  872.        Qfill       ( 5,12,10,25,Black+LightGray,' ');  { Clear the area }
  873.        QwriteC (9,12,36,SameAttr,'Pop-Up Window');     { Label window   }
  874.        delay (1000);                                   { Wait a sec     }
  875.        QstoreToMem ( 5,12,10,25,MyWindow);             { Save a copy    }
  876.        QstoreToScr ( 5,12,10,25,MyUnderlay);           { Restore screen }
  877.        { -- Move window some where else. -- }
  878.        QstoreToMem ( 8,25,10,25,MyUnderlay);  { Save area to be covered }
  879.        QstoreToScr ( 8,25,10,25,MyWindow);             { Move window    }
  880.        delay (1000);                                   { Wait a sec     }
  881.        { -- Remove window. -- }
  882.        QstoreToScr ( 8,25,10,25,MyUnderlay);           { Restore screen }
  883.      end.
  884.  
  885.    Compile and run the code.  You will see a 10 row by 25 column window 
  886.    located at (5,12) which is row 5, column 12 .  After one second, it will be 
  887.    moved to (8,25).  Then after another second, it is removed from the screen.  
  888.    We did a lot of work with very little code!
  889.  
  890.    Rows-by-Cols - QstoreToScr and QstoreToMem are screen saving and restoring 
  891.    procedures that conveniently work in row-by-column blocks.  They 
  892.    accommodate any column mode, so there is no need to be concerned about 
  893.  
  894.  
  895.    Chapter 3, Basic Techniques                                         Page 15
  896.    QWIK Screen Utilities                             User's Guide, Version 5.x
  897.  
  898.  
  899.    screen width.
  900.  
  901.    Memory Requirements - Notice that QstoreToMem wrote the data direct to 
  902.    memory in MyWindow.  It is important that the memory allocated to that 
  903.    variable is correct to prevent it from overwriting any other variables.  
  904.    The array size chosen was a 250 word array which is a perfect fit since one 
  905.    word is needed for each character and attribute on the screen.  If you 
  906.    prefer, the heap can also be used such as:
  907.  
  908.      var MyUnderlay: pointer;
  909.      begin
  910.        GetMem (MyUnderlay,500);
  911.        QstoreToMem ( 5,12,10,25,MyUnderlay^);  
  912.        { ... }
  913.        FreeMem (MyUnderlay,500);
  914.      end.
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.    Chapter 3, Basic Techniques                                         Page 16
  957.    QWIK Screen Utilities                             User's Guide, Version 5.x
  958.  
  959.  
  960.    4.  A D V A N C E D   T E C H N I Q U E S
  961.  
  962.    This section will acquaint you with the powerful virtual screen writing 
  963.    features already built into QWIK.  You will also find out easy it is to 
  964.    work on multiple video pages and how to accommodate video mode changes.
  965.  
  966.  
  967.    VIRTUAL SCREENS
  968.  
  969.    This topic will show you how to create and use powerful virtual screens.
  970.  
  971.    Virtual Screen - Just what is a virtual screen?  It is a screen maintained 
  972.    in RAM of any dimensions that can be reproduced on the CRT in full or in 
  973.    part.  The advantages are:
  974.  
  975.      . Variable row-by-column screen 
  976.      . Large video buffer up to 64k
  977.      . High speed in RAM
  978.      . Unlimited number of screens
  979.  
  980.    Screen Record - QWIK uses seven variables to define any screen.  At start 
  981.    up, QWIK initializes them to the video system detected:
  982.  
  983.      CRTrows  - Number of rows
  984.      CRTcols  - Number of columns
  985.      CRTsize  - Byte allocation for screen
  986.      Qsnow    - True if snow checking needed
  987.      QEosOfs  - EOS offset
  988.      QScrOfs  - Screen offset
  989.      QScrSeg  - Screen segment
  990.  
  991.    To make data access even easier, all these variables are contained in the 
  992.    record QScrRec of VScrRecType.  In addition, QScrPtr is absolute to QScrOfs 
  993.    and QScrSeg.  This gives QWIK a true far pointer, so screens can be 
  994.    anywhere in memory and not just paragraph aligned!
  995.  
  996.    Creating Virtual Screens - In three easy steps, you can easily create a 
  997.    virtual screen:
  998.  
  999.      1. Allocate memory for the screen.
  1000.      2. Save the current screen record.
  1001.      3. Modify the screen record for the virtual screen.
  1002.  
  1003.    Let's write some code that does just that:
  1004.  
  1005.      uses Qwik;
  1006.      var  CRTrec,VScrRec: VScrRecType;
  1007.      begin
  1008.        with VScrRec do             { create specs for virtual screen }
  1009.          begin
  1010.            Vrows := 80;            { Let's choose 80 rows }
  1011.            Vcols := 100;           { Let's choose 100 columns }
  1012.            Vsize := Vrows * Vcols shl 1;
  1013.            Vsnow := false;         { Can always be false }
  1014.            VEosOfs := 0;           { Be safe and start at the base }
  1015.  
  1016.  
  1017.    Chapter 4, Advanced Techniques                                      Page 17
  1018.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1019.  
  1020.  
  1021.            GetMem (VScrPtr,Vsize); { Allocate heap space }
  1022.          end;
  1023.        CRTrec  := QScrRec;         { Save CRT specs     }
  1024.        QScrRec := VScrRec;         { Set virtual specs  }
  1025.        { ... }                     { Write to the virtual screen }
  1026.        QScrRec := CRTrec;          { Restore CRT specs when done! }
  1027.      end.
  1028.  
  1029.    Now, when you use any QWIK routine, they can be directed to the virtual 
  1030.    screen - writing, reading, scrolling, wrapping, and everything you would 
  1031.    expect.  Qsnow can always be false when writing to virtual screens since 
  1032.    RAM is used and not video card memory.
  1033.  
  1034.    Cursor Control - One thing not available to virtual screens is cursor 
  1035.    movement, because the cursor location is reserved by DOS for just video 
  1036.    pages.  That means there is no cursor available for virtual screens.  So, 
  1037.    how can we get around this?  The EOS marker comes to the rescue as an 
  1038.    indispensable cursor!  All EOS routines can still be used as before.
  1039.  
  1040.    Taking a Peek - At some time, we will need to take a look at all or a 
  1041.    portion of the virtual screen by copying it to the CRT.  Two inter-screen 
  1042.    procedures do this by blocks at high speed - QScrToVscr and QVscrToScr.  
  1043.    Here are the parameters of QVscrToScr: 
  1044.  
  1045.      QVscrToScr (Row,Col,Rows,Cols,Vrow,Vcol,Vwidth,VScrPtr);
  1046.  
  1047.    Just like QstoreToScr, Row, Col, Rows, and Cols describe the position and 
  1048.    size on the screen (Scr).  This screen is specified by QScrRec which is 
  1049.    usually the CRT.  VScrPtr points to the virtual screen (Vscr).  Now, where 
  1050.    is the same size block on Vscr?  It's at Vrow and Vcol.  But the Vscr may 
  1051.    have a different column width than CRTcols.  So you specify that with 
  1052.    Vwidth.  Only the Scr side checks for possible snow.  These procedures are 
  1053.    extremely fast making virtual screens very practical.  See QScrToVscr and 
  1054.    QVscrToScr in QWIKREF.DOC for more examples.
  1055.  
  1056.    Multiple Virtual Screens - By changing QScrRec, you can even copy blocks 
  1057.    from one virtual screen to another!  These routines do not affect QEosOfs.
  1058.  
  1059.  
  1060.    VIDEO PAGES
  1061.  
  1062.    Multi-page Cards - TP5 procedures such as Write, Window, and GotoXY are 
  1063.    dedicated to just page 0, but many video cards have more than one page.  If 
  1064.    you have a CGA or better, you already have memory on your card for 4 to 8 
  1065.    pages.  Since the BIOS recognizes them as well, QWIK gives you access to 
  1066.    these extra pages.
  1067.  
  1068.    Page Control - QwritePage and QviewPage give you the power to use QWIK on 
  1069.    all video pages and display which ever you choose.  On a multiple-video 
  1070.    page card like CGA, you can simply code:
  1071.  
  1072.      QwritePage (MyPage);
  1073.  
  1074.    to make all QWIK routines be directed to your selected video page even 
  1075.    though you could be viewing another page.  To view a page, you can in turn 
  1076.  
  1077.  
  1078.    Chapter 4, Advanced Techniques                                      Page 18
  1079.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1080.  
  1081.  
  1082.    simply code: 
  1083.  
  1084.      QviewPage (MyPage);
  1085.  
  1086.    Tips About Pages - Here are some tips to keep in mind when using several 
  1087.    video pages:
  1088.  
  1089.      . The highest valid video page is detected by Qinit and saved in the 
  1090.        variable MaxPage.
  1091.      . Invalid page parameters are just ignored.
  1092.      . The BIOS reserves a separate cursor location for each of up to 8 
  1093.        video pages.
  1094.      . There is only one possible cursor mode which is always displayed on 
  1095.        the CRT.
  1096.      . The cursor location routines operate on the page being written 
  1097.        rather than viewed.
  1098.      . The current video page viewed is found with VideoPage.
  1099.      . The current video page set by QwritePage is saved in QvideoPage.
  1100.      . Be sure to end your programs with "QviewPage (0);". 
  1101.  
  1102.  
  1103.    VIDEO MODES    
  1104.  
  1105.    CRT Unit - If you intend to use the CRT unit with QWIK, it is best to place 
  1106.    the CRT unit first in the "USES" list.  When the CRT runs its 
  1107.    initialization code, it checks for the video mode to see if it is a valid 
  1108.    text mode (0..3,7).  If so, it remains in that mode.  If not, it is in a 
  1109.    graphics or extended column mode and is forced back into the computer's 
  1110.    default text mode as set by the equipment flag at $40:$10.  By having the 
  1111.    CRT unit first, you can be assured of a valid text mode when Qinit is run.
  1112.  
  1113.    Changing Text Modes - Your application may require a change in video modes 
  1114.    for different row or column modes.  If so, after the mode is changed, run 
  1115.    Qinit again so the video variables will be correct.
  1116.  
  1117.    TextAttr - Be advised that a change of text modes with the CRT unit will 
  1118.    also change TextAttr.  It is set to what ever attribute is at the cursor.
  1119.  
  1120.    Graphic Modes - If you need to alternate with a graphics mode, Qinit does 
  1121.    not need to be run provided you return back to the same text mode.  Of 
  1122.    course you may want to save the screen with QstoreToMem before switching to 
  1123.    graphics. 
  1124.  
  1125.    Changing Monitors - The technique to change monitors is to simply change 
  1126.    the text mode.  This means Qinit should be run again.  Be sure to toggle 
  1127.    the video mode bits in the equipment list byte at $40:$10 so other 
  1128.    applications can behave properly.
  1129.  
  1130.    CursorInitial - When QWIK is initialized, CursorInitial saves what it 
  1131.    detects for the current video mode.  Whenever Qinit is run again, 
  1132.    CursorInitial is also changed.  This may affect how you restore the cursor 
  1133.    when terminating.  If needed, the value should be saved before using Qinit.
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.    Chapter 4, Advanced Techniques                                      Page 19
  1140.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1141.  
  1142.  
  1143.    MULTI-TASKING ENVIRONMENTS 
  1144.  
  1145.    Multi-Tasking - QWIK works very well with multi-tasking environments such 
  1146.    as DESQview.  For examples on how to let QWIK work in DESQview, see a file 
  1147.    called DESQ5X.ARC or a later version.  The key is to set Page0seg, QScrPtr 
  1148. |  and Qsnow correctly.  This is a very simple task.  If you are unsuccessful 
  1149. |  in getting it to work as you would expect, give us a call.
  1150.  
  1151.    Cursor Routines and the BIOS - All cursor routines that change the mode and 
  1152.    location use the BIOS.  This way multi-tasking environments can handle 
  1153.    redirection properly.
  1154.  
  1155.  
  1156.    INTERRUPTS
  1157.  
  1158.    Within QWIK - QWIK only uses video interrupt $10 for Qinit and the cursor 
  1159.    routines so there no problem with DOS re-entry.  Please read about "System 
  1160.    Hardware" on page 22 for more information on procedure GetSubModelID which 
  1161.    uses INT $15.
  1162.  
  1163.    Creating Handlers - If you use interrupt calls (like a clock display) 
  1164.    within your program that use QWIK routines, be sure to save and restore the 
  1165.    value of QScrRec in the call so it won't return to the main program with 
  1166.    unexpected results.  You should also be aware that main program may be 
  1167.    writing to a virtual screen during the interrupt, so it is best that you 
  1168.    initialize a copy of a QScrRec solely for the interrupt.
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.    Chapter 4, Advanced Techniques                                      Page 20
  1201.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1202.  
  1203.  
  1204.    5.  H A R D W A R E   D E T E C T I O N
  1205.  
  1206.  
  1207.    DISPLAY COMBINATION CODE
  1208.  
  1209.    Qinit Procedure - Qinit initializes all the variables needed for the QWIK 
  1210.    procedures.  And specifically checks for ALL IBM video equipment including 
  1211.    dual monitors.  Qinit is initialized by the unit at start up.
  1212.  
  1213.    Display Combination Code (DCC) - The PS/2 video BIOS has a new function 
  1214.    that simplifies equipment detection called the Read/Write Display 
  1215.    Combination Code.  Using interrupt $10 with AH = $1A00, the call will 
  1216.    return the Active Display Device in BL and the Alternate Display Device in 
  1217.    BH.  If the function is supported, it also returns $1A to AL.  For the 
  1218.    possible Display Device codes which have been assigned by IBM, see 
  1219.    QWIKREF.DOC.
  1220.  
  1221.    Conforming to DCC - No results are obtained for the DCC on anything other 
  1222.    than PS/2 equipment.  However, to be consistent, Qinit was reprogrammed to 
  1223.    conform to the DCC for ALL equipment.  To see if a CGA is in use, simply 
  1224.    check to see if ActiveDispDev=CgaColor.  Qinit only sets the parameters for 
  1225.    the active display.  
  1226.  
  1227.    Dual Monitors - Qinit detects dual monitors and saves both the active and 
  1228.    alternate display device codes.  The alternate display device code is for 
  1229.    testing purposes only.  If you change monitors in a running program, Qinit 
  1230.    should be executed again. 
  1231.  
  1232.    Testing for Dual Monitors - Qinit makes an attempt to detect for a second 
  1233.    monitor by several means.  If no alternate cards like EGA or VGA are found, 
  1234.    an alternate 6845 video chip (CGA, MDA, or Hercules) is checked.  If the 
  1235.    chip is found, then further tests are made to find which card it could be.  
  1236.    The chip existence test is highly reliable.  If no alternate display device 
  1237.    is found, then AltDispDev=NoDisplay.
  1238.  
  1239.    HavePS2 - Qinit sets HavePS2 to true if the DCC is supported.  This means 
  1240.    that the program has detected a PS/2 video card whether it is integrated in 
  1241.    a Model 30, a PS/2 Display Adapter installed on an IBM XT, or the like.  It 
  1242.    also means that either MCGA or VGA is present, but not necessarily active.  
  1243.    To know which, just check the DCC.
  1244.  
  1245.    Have3270 - If Qinit detects 3270 PC equipment/software, this variable is 
  1246.    set to true.  In addition, the ActiveDispDev is either MdaMono or CgaColor.  
  1247.    Note: There may or may not be graphics capability in either case; Qinit is 
  1248.    not meant to detect graphics.  If Have3270 is true, then ActiveDispDev3270 
  1249.    will be set to the proper code.  On the 3270 PC, dual monitors are not 
  1250.    possible as they use the same physical buffer space.  In addition, even 
  1251.    though a color monitor maybe used, there is only one video page unless 
  1252.    there is a special adapter.  However, Qinit will determine if more than 
  1253.    just one page is available.  The 3270 PC also does not support 40 column 
  1254.    modes.
  1255.  
  1256.    EGA Switches - By checking the value of this byte, you can determine the 
  1257.    monitor connected to the EGA, the alternate video system, and the start up 
  1258.    default.  The byte is a copy of how the dip switches are set on the card 
  1259.  
  1260.  
  1261.    Chapter 1, Hardware Detection                                       Page 21
  1262.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1263.  
  1264.  
  1265.    where on=0 and off=1.  The primary is the default.  When the ECD is set for 
  1266.    640x200, it is emulating the CD including the cursor mode.  Qinit now 
  1267.    directly tests for the alternate device rather than assuming it.
  1268.  
  1269.    EGA Information - The byte located at $0040:$0087 has hardware status 
  1270.    information when the EGA (or VGA) is present.
  1271.  
  1272.    PC Convertible (PCC) - Since the PCC also does not support the DCC, a 
  1273.    separate code is used.  If the 5140 LCD is used in mode 7, the Active 
  1274.    Display Device is set to MdaMono which is close enough.  This set up can be 
  1275.    verified by testing if MaxPage=3.  The alternate display is found by using 
  1276.    interrupt $10 with AH=$15.  The result is saved in AltDispDevPCC.  Of 
  1277.    course the variable is undefined if a PCC is not used.
  1278.  
  1279.    Hercules - Hercules cards are also detected.  If either the active or 
  1280.    alternate DCC is MdaMono, which is found by verifying a responsive 6845 
  1281.    video chip at the mono register port, then an attempt is made to find if 
  1282.    any Hercules card is attached.  If no Hercules card is found, then 
  1283.    HercModel=NoHerc; it is then assumed that just an MDA card is attached.  
  1284.    Because the test can take up to 1/3 of a second on slower computers, this 
  1285.    test is only run once, even if Qinit is executed again.  The tests for the 
  1286.    Hercules cards are the ones recommended by Hercules Computer Technology, 
  1287.    which also admits that sometimes the tests will fail during multi-tasking 
  1288.    activity.  Hercules clones may not be detected by these tests, but the DCC 
  1289.    will be correct.
  1290.  
  1291.  
  1292.    SNOW CHECKING
  1293.  
  1294.    CGA Snow - QWIK is conservative with CGA cards and uses snow checking when 
  1295.    the card is detected.  However, it is not needed in 40 column modes 0 and 
  1296.    1.  Qinit was programmed to accommodate this.  For other hardware, you can 
  1297.    change Qsnow to suit your needs, but CardSnow should be left unchanged to 
  1298.    save what Qinit detected.  
  1299.  
  1300.    Zenith CGA - Zenith CGAs do not need wait-for-retrace.  If you would like 
  1301.    to accommodate this, you can execute the following procedure early in your 
  1302.    programs and to be run after each Qinit:
  1303.  
  1304.      procedure CheckZenith;
  1305.      var  ZdsRom: array[1..8] of char absolute $F000:$800C;
  1306.      begin
  1307.        if Qsnow and (ZdsRom='ZDS CORP') then
  1308.          begin
  1309.            Qsnow    := false;
  1310.            CardSnow := false;
  1311.          end;
  1312.      end;
  1313.  
  1314.    CheckSnow - If you plan on using the standard CRT unit, place the following 
  1315.    line early in your programs and after each Qinit.
  1316.  
  1317.     CheckSnow := Qsnow;
  1318.  
  1319.    Qinit appears to be more extensive in it's testing for wait-for-retrace.  
  1320.  
  1321.  
  1322.    Chapter 1, Hardware Detection                                       Page 22
  1323.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1324.  
  1325.  
  1326.    Then, Write and WriteLn will work faster if DirectVideo is true.  
  1327.  
  1328.    Critical Timing - The timing on the IBM PC (Intel 8088 at 4.77MHz) with a 
  1329.    CGA is critical for storing characters and attributes with 16-bit transfers 
  1330.    because of the CPU architecture and slow speed.  Although previous versions 
  1331.    kept the timing as tight as possible, there still remained a hint of snow 
  1332.    in column 1.  This is due to the problem that RAM runs a little slower than 
  1333.    BIOS ROM.  This problem has now been solved with a minor code change.  So 
  1334.    the routines still run at the same speed, but there is absolutely no snow!  
  1335.    I am not aware of any other routines that have done this as closely.  
  1336.    (Computers with slower access RAM chips may still show up some variations 
  1337.    from time to time.  Feedback is requested.)
  1338.  
  1339.  
  1340.    SYSTEM HARDWARE
  1341.  
  1342.    System ID - The basic computer system identification (or model) for IBM 
  1343.    computers can be found by directly accessing the byte in memory at 
  1344.    $F000:$FFFE.  
  1345.  
  1346.    SubModel ID - After production of the AT, models were also given Submodel 
  1347.    IDs.  To get both the model and submodel ID, you must use interrupt $15 
  1348.    with AH=$C0 which only works on some computers.  A few PC and XT clones 
  1349.    like the AT&T 6300 will actually crash when this interrupt is executed due 
  1350.    to BIOS bugs.  So to prevent this from happening, the procedure only lets 
  1351.    SystemIDs of $FC or less get the SubModelID.  In addition, it was made it 
  1352.    into a separate procedure called GetSubModelID and is no longer apart of 
  1353.    Qinit.  So you will have to execute it yourself to get a result.  The 
  1354.    routine is entirely optional and is not required by QWIK.
  1355.  
  1356.    CPU Identification - A CPU detection routine has been included for Intel 
  1357.    processors.  It is useful for clones that do not recognize IBM's system ID 
  1358.    scheme.  The idea came from Juan Jimenez as it appeared in Jan/Feb '88 
  1359.    Turbo Technix magazine.  The routine has been simplified for reduced code 
  1360.    (only 42 bytes) and enables use of simple constant identifiers.  This 
  1361.    routine is required for Qscroll*.
  1362.  
  1363.  
  1364.    TIPS
  1365.  
  1366.    EgaMono - You should be aware that another constant also named EGAMono is 
  1367.    used by the DetectGraph procedure in the Graph unit, but fortunately, they 
  1368.    have the same value!
  1369.  
  1370.    Longer names - If you wish to be more explicit with procedure, function, 
  1371.    and variable names, you can always add the unit name as a prefix:
  1372.  
  1373.      Qwik.GotoRC (1,1);
  1374.      MyCols:=Qwik.CRTcols;
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.    Chapter 1, Hardware Detection                                       Page 23
  1384.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1385.  
  1386.  
  1387.    A P P E N D I X   A :  V I D E O   M O D E   T A B L E
  1388.  
  1389.  
  1390.    Video Modes - To help you figure out how the all IBM video systems are 
  1391.    configured, it is helpful to have a table of all the possible Alphanumeric 
  1392.    (A/N or text) modes.  QWIK was not designed for the All Points Addressable 
  1393.    (APA or graphics) modes.  
  1394.  
  1395.              TABLE 1: Hardware Specific Video Mode Characteristics
  1396. -------------------------------------------------------------------------------
  1397. Mode Format Segment Display Box  MDA CGA EGA MCGA VGA PCjr PCC 3270 HGC MaxPage
  1398. ---- ------ ------- ------- ---- --- --- --- ---- --- ---- --- ---- --- -------
  1399. 0,1  40x25  B800:0  320x200 8x8       x   x   x    x   x    x              7
  1400.                     320x350 8x14          x        x                       7
  1401.                     320x400 8x16              x                            7
  1402.                     360x400 9x16                   x                       7
  1403. 2,3  80x25  B800:0  640x200 8x8       x                x    x              3
  1404.                     640x200 8x8           x        x                       7 *
  1405.                     640x350 8x14          x        x                       7 *
  1406.                     640x400 8x16              x                            7
  1407.                     720x350 9x14                                x          0+
  1408.                     720x400 9x16                   x                       7
  1409. 7    80x25  B000:0  720x350 9x14  x                         x   x    x     0 
  1410.                     720x350 9x14          x        x                       7 *
  1411.                     720x400 9x16                   x                       7
  1412.                     640x200 8x8                             x              3
  1413. -------------------------------------------------------------------------------
  1414.  
  1415.      Legend:
  1416.      Format  - Characters per row by the number of rows in the data area.
  1417.      Segment - Address of the first character on page 0 of the display 
  1418.                buffer.
  1419.      Display - The pixel resolution for the data area excluding the 
  1420.                border, horizontal by vertical.
  1421.      Box     - The pixel resolution for each character, horizontal by 
  1422.                vertical.
  1423.      MDA     - Monochrome Display and Printer Adapter
  1424.      CGA     - Color Graphics Adapter 
  1425.      EGA     - Enhanced Graphics Adapter
  1426.      PGC     - Professional Graphics Controller
  1427.      MCGA    - Multi-Color Graphics Array
  1428.      VGA     - Video Graphics Array
  1429.      PCjr    - PC Junior
  1430.      PCC     - PC Convertible
  1431.      HGC     - Hercules Graphics Cards - HGC, HGC Plus, and InColor Card
  1432.      3270    - All IBM 3270 PC adapters
  1433.      MaxPage - 0-based highest page number; e.g. 7 means there are 8 
  1434.                pages.
  1435.      MD      - 5151 Monochrome Display
  1436.      CD      - 5153 Color Display
  1437.      ECD     - 5154 Enhanced Color Display
  1438.  
  1439.      Notes:
  1440.      1. The 0 and 2 modes suppress color burst only on composite displays 
  1441.         (not RGB) only for CGA and EGA.
  1442.  
  1443.  
  1444.    Appendix A: Video Mode Table                                        Page 24
  1445.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1446.  
  1447.  
  1448.      2. The PS/2 model 25 and 30 have an integrated MCGA.  The model 50 
  1449.         and above have an integrated VGA.
  1450.      3. The 8514 High Content Color Display along with the 8514/A adapter 
  1451.         produces a superset of the VGA for APA, but there is no 
  1452.         differences in the A/N modes to the VGA when the adapter is in 
  1453.         "VGA" mode.  See IBM documentation for Advanced Function Mode.
  1454.      4. MaxPage is reduced to 3 if EGA only has 64K graphics memory 
  1455.         installed for modes marked "*".  MaxPage of 7 is for 128K or more.
  1456.      5. The PCC can have either an alternate MDA or CGA.  The LCD (model 
  1457.         5140) can emulate either the MDA or CGA modes, but the MDA mode is 
  1458.         640x200.
  1459.      6. No information is provided on the PGC.
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.    Appendix A: Video Mode Table                                        Page 25
  1506.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1507.  
  1508.  
  1509.    A P P E N D I X   B :  C U R S O R   M O D E   D A T A
  1510.  
  1511.    Each video card differs in character cell size and cursor emulation in 
  1512.    different video modes.  The following data will show you the specific 
  1513.    differences between modes and cards, and how QWIK handles them.
  1514.  
  1515.  
  1516.    CURSOR MODE TABLES
  1517.  
  1518.    Cursor Mode Word - The cursor mode is saved in low memory at $40:$60 after 
  1519.    each mode change.  Using hex is the easiest way to analyze the word.  The 
  1520.    shape of the cursor is defined by horizontal scan lines in the character 
  1521.    cell where the top row is of any cell is 0.  
  1522.  
  1523.                           TABLE 2: Cursor Mode Word
  1524.               -------------------------------------------------
  1525.                       Hi byte                  Lo byte   
  1526.               -----------------------   -----------------------
  1527.      Bit #:   15 14 13 12 11 10 09 08   07 06 05 04 03 02 01 00
  1528.      Bit #:   07 06 05 04 03 02 01 00   07 06 05 04 03 02 01 00  
  1529.      Symbol:      $  $  *  *  *  *  *       @  @  +  +  +  +  + 
  1530.      
  1531.      Key:     $ - controls cursor on/off and erratic blinking
  1532.               * - controls top scan line (0-based)
  1533.               @ - controls skew to the right 
  1534.               + - controls bottom scan line (0-based)
  1535.  
  1536.  
  1537.    Skew - Bits 5 and 6 control the skew or shift to the right of the cursor on 
  1538.    EGA/VGA cards.  Consistent results between video cards is not dependable so 
  1539.    it is best to leave these bits at zero. 
  1540.  
  1541.    Cell Sizes - Because of different cells sized with different video cards, 
  1542.    the top and bottom scan lines are also different for each card.  See TABLE 
  1543.    1 in Appendix A for specific cell sizes.
  1544.  
  1545.                     TABLE 2: Cursor Mode Defaults
  1546.      ----------------------------------------------------------
  1547.      Adapter   Default  Comments
  1548.      --------  -------  ---------------------------------------
  1549.      MDA       $0B0C
  1550.      CGA,MCGA  $0607
  1551.      EGA       $0B0C    MD, ECD (640x350 25-line) Emulation off
  1552.      EGA       $0607    CD, ECD (640x200)
  1553.      VGA       $0D0E    Emulation off
  1554.      3270 PC   $0D0D    And converts MDA and CGA
  1555.  
  1556.  
  1557.    CURSOR EMULATION
  1558.  
  1559.    Cursor Emulation - Qinit sets the four standard cursor mode variables at 
  1560.    startup to be either MDA or CGA defaults.  Almost all emulation modes can 
  1561.    be handled by either of these two cell sizes.  Qinit handles certain 
  1562.    exceptions.  If you want to handle your own exceptions, the following notes 
  1563.    will help you.
  1564.  
  1565.  
  1566.    Appendix B: Cursor Mode Data                                        Page 26
  1567.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1568.  
  1569.  
  1570.  
  1571.    CursorBlink - This mode is hardware specific.  It works on MDA and CGA 
  1572.    while it turns the cursor off on EGA and VGA.
  1573.  
  1574.    MCGA/VGA Cursor Mode - On these two cards, you can both read and write the 
  1575.    cursor mode direct from the CRTC.  To be compatible with all video cards, 
  1576.    QWIK does not attempt to do this, but instead depends on the Video Display 
  1577.    Data Area at $40:$60.  Qinit turns on the cursor emulation mode if PS/2 
  1578.    video equipment is detected.
  1579.  
  1580.    EGA Cursor Emulation - In 25-line mode on the EGA, cursor emulation works 
  1581.    fairly well.  In other line modes, the emulation falters.  So just like CRT 
  1582.    unit, Qinit forces emulation to be turned on in 25-line mode and off in 
  1583.    other modes.  On the EGA, emulation is turned off by setting bit 0 of 
  1584.    EgaInfo to 1.  The standard QWIK cursor modes are still set appropriately.
  1585.  
  1586.    MCGA Cursor Emulation - Use the CGA cursor cell size even though the 
  1587.    character cell is 8x16.  The BIOS multiplies the start and end rows by 2 
  1588.    and then adds one to the end row before writing to the hardware video port 
  1589.    to emulate the CGA.
  1590.  
  1591.    VGA Cursor Emulation - Qinit turns the cursor emulation mode on so you 
  1592.    don't have to worry about special fonts and cells sizes as it emulates the 
  1593.    MDA and CGA.  The video BIOS will adjust your cursor shape to fit in the 
  1594.    current cell size.  For the algorithms specific to the VGA, refer to the 
  1595.    "IBM BIOS Interface Technical Reference Manual".  
  1596.  
  1597.    3270 PC Peculiarities - The 3270 PC cursor types are limited to only three.  
  1598.    In addition, the underline cursor is not visible on a white background on 
  1599.    the 5272 color display and it is advisable to use a block cursor together 
  1600.    with that attribute.  Notice that half-block cursors are converted to full 
  1601.    block:
  1602.  
  1603.                      TABLE 3: 3270 PC Cursor Modes
  1604.      --------------------------------------------------------------
  1605.      Cursor Type   Comments
  1606.      ------------  ------------------------------------------------
  1607.      Underline     $0D0D only.  CGA and MDA are emulated. 
  1608.      Hidden (off)  cursor start > cursor end.  $2000 is preferred.
  1609.      Block         anything other than the above
  1610.  
  1611.  
  1612.    Start Up Cursor Modes - Once QWIK determines the cell size and the cursor 
  1613.    emulation mode, the four standard cursor modes, CursorInitial, 
  1614.    CursorUnderline, CursorHalfBlock and CursorBlock are calculated:
  1615.  
  1616.        CursorInitial - This is the cursor mode detected at startup.  An 
  1617.        improper default for MDA is automatically overridden to an 
  1618.        underline.  Some early PCs have a BIOS bug that sets the MDA 
  1619.        default incorrectly.
  1620.  
  1621.        CursorUnderline - The lower scan line is set to: (BottomOfCell-1).  
  1622.        The upper scan line is set to: (LowerScan-1).
  1623.  
  1624.        CursorHalfBlock - The top scan line is set to: (BottomOfCell+1)/2.  
  1625.  
  1626.  
  1627.    Appendix B: Cursor Mode Data                                        Page 27
  1628.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1629.  
  1630.  
  1631.        This may appear a little fat for EGAs in 25-line mode, but is just 
  1632.        right for all other cards and modes.
  1633.  
  1634.        CursorBlock - Produces a block cursor by setting the top scan line 
  1635.        to zero of CursorUnderline.
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.    Appendix B: Cursor Mode Data                                        Page 28
  1689.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1690.  
  1691.  
  1692.    A P P E N D I X   C :   P E R F O R M A N C E
  1693.  
  1694.  
  1695.    CODE SIZE
  1696.  
  1697.    If you use a QWIK procedure, only the corresponding object file containing 
  1698.    that procedure will be linked and thereby optimizing the code.  Even if all 
  1699.    procedures are used, QWIK is still quite small at a total of 2496 bytes 
  1700.    while the STRS unit is 240 bytes.  Here's the linked code size:
  1701.  
  1702.      FILE NAME    BYTES  PROCEDURES
  1703.      ------------ -----  -------------------------------------------------
  1704.      Qinit   .obj  592   Qinit - always linked when QWIK is USEd
  1705.      Qwrites .obj  350   Qwrite, QwriteC, QwriteA, QwriteEos, QwriteEosA
  1706.      Qfills  .obj  439   Qfill, Qattr, QfillC, QattrC, QfillEos, QattrEos
  1707.      Qstores .obj  293   QstoreToScr, QstoreToMem, QScrToVscr, QVscrToScr
  1708.      Qreads  .obj  127   QreadStr, QreadChar, QreadAttr
  1709.      Qscrolls.obj  269   QscrollUp, QscrollDown
  1710.      Qpages  .obj   61   QwritePage, QviewPage
  1711.      Cursor  .obj   96   GotoRC, WhereR/C, SetCursor, GetCursor, ModCursor
  1712.      Eos     .obj  131   GotoEos, EosR/C, EosToRC/rel, EosToCursor, EosLn
  1713.      QEosLn  .obj   37   QEosLn
  1714.      CpuIdent.obj   42   GetCpuID
  1715.      GetSubID.obj   27   GetSubModelID
  1716.      Qwik    .tpu   32   Initialize and paragraph round up 
  1717.  
  1718.  
  1719.    SPEED
  1720.  
  1721.    How fast is fast?  To have a basis for comparision, a unit of 
  1722.    "screens/second" is used to get a feeling for speed.  To make one screen, a 
  1723.    procedure is repeated with a FOR loop to fill several 80x25 pages and 
  1724.    timed.  Qwrite- uses 80 character strings, and Qattr and Qfill use Rows:=25 
  1725.    and Cols:=80.  Here are some samples from the systems that have been 
  1726.    tested.  16-bit video cards such as the one in the Compaq 386/20 will be 
  1727.    much faster than 8-bit cards.
  1728.  
  1729.      ------------------ S C R E E N S / S E C O N D -----------------
  1730.                 Chng  XT(4.77 MHz)  M30    M50    M70    ATT+  Compaq
  1731.      Procedure  Attr  EGA     CGA   MCGA   VGA    VGA    CGA   386/20
  1732.      ---------  ----  ------------  -----  -----  -----  ----  ------
  1733.      Qwrite-     Yes   32.8   9.5    75.4   88.4  113.3  16.8   418.4
  1734.                  No    42.4   9.5    90.0  138.1  191.9  16.8   450.4
  1735.      Qfill-      Yes   81.2  11.8   164.1  147.3  151.0  21.5   579.6
  1736.                  No    73.7   7.4   141.3  174.4  251.0  13.9   574.9
  1737.      Qattr-      Yes   72.6   7.4   141.3  174.4  254.9  14.0   570.3
  1738.      Qstore-     n/a   59.1   7.2   111.6  127.4  139.4  13.8   351.8
  1739.      Qscroll-    n/a   32.9   5.6    62.2   71.1   77.7  16.8   317.9
  1740.  
  1741.    For those interested in comparisons, QWIK is much faster than the TP5 
  1742.    direct video routines by the following percentage:
  1743.  
  1744.      Procedure  CGA cards  All Other cards     
  1745.      ---------  ---------  ---------------     
  1746.      Writeln     125%       650%               
  1747.  
  1748.  
  1749.    Appendix C: Performance                                             Page 29
  1750.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1751.  
  1752.  
  1753.  
  1754.  
  1755. |  TP4 USAGE
  1756. |
  1757. |  QWIK5X.ARC is simply QWIK42B.PAS compiled under TP5.  If you need to 
  1758. |  evaluate QWIK under TP4, obtain the TP4 version of QWIK.  Here are the 
  1759. |  versions for each compiler:
  1760. |
  1761. |     File         Compiler
  1762. |     -----------  ---------
  1763. |     QWIK5X.TPU   TP5
  1764. |     QWIK42B.TPU  TP4
  1765. |
  1766. |  If you have the source code and want to recompile QWIK, be sure to use the 
  1767. |  correct directives at the top of the file by locating the "$" on the 
  1768. |  appropriate line.  This a simple but important task.  The important 
  1769. |  directive in TP5 is the alignment directive $A-.  It must be turned off or 
  1770. |  QScrRec will not be addressed correctly.
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.    Appendix C: Performance                                             Page 30
  1811.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1812.  
  1813.  
  1814.    A P P E N D I X   D :  A P P L I C A T I O N   P R O D U C T S
  1815.  
  1816.  
  1817. |  Eagle Performance Software has developed identical products for both 
  1818. |  Turbo C and Turbo Pascal.  Our pledge is to provide you quality products 
  1819. |  with unparalleled performance and ease of use.  All registered users 
  1820. |  receive the complete source code when a signed license agreement is 
  1821. |  returned.
  1822.  
  1823.  
  1824.    QWIK
  1825.  
  1826.    QWIK - Here are the product versions and release dates for QWIK utilities:
  1827.  
  1828.       File name    CIS Name    Compiler  Release date
  1829.       -----------  ----------  --------  ------------
  1830.       QWIK42B.ARC  QWIK42.ARC  TP4        10-01-88
  1831.       QWIK5X.ARC   QWIK5X.ARC  TP5        12-20-88
  1832.       QWIKC20.ARC  QWKC20.ARC  TC2        12-03-88
  1833.  
  1834.  
  1835.    WNDW
  1836.  
  1837.    WNDW - For multi-level virtual windows, WNDW is the highest performance 
  1838.    window utilities available today.  It offers very powerful utilities for 
  1839.    full window control and management you probably never thought possible.   
  1840.    They are simple and yet very powerful with high speed and tight code.  With 
  1841.    WNDW, you can choose the absolute writing routines of QWIK, the window-
  1842.    relative writing routines of WNDW, and even customize your own.  Here are 
  1843.    some of the features you will discover:
  1844.  
  1845.      - Uses the powerful direct screen writing routines of QWIK.           
  1846.      - Up to 254 fixed or virtual windows can be on the screen at one 
  1847.        time.
  1848.      - Extremely high-speed virtual screens in RAM (up to 40 times 
  1849.        faster).
  1850.      - Virtual windows are fully updated on screen, even if covered.  
  1851.        Screens can scroll underneath one another right on the screen at 
  1852.        very high speeds!       
  1853.      - Virtual windows have virtual titles.                                
  1854.      - Fully supported hidden windows saved in RAM.                        
  1855.      - Fully supports all video pages.                                     
  1856.      - Adjustable-rate moving, resizing, and scrolling.                    
  1857.      - All windows can be randomly accessed, not just stacked or tiled.    
  1858.      - 28 window-relative writing routines.                                
  1859.      - 15 different border styles with shadow and zoom effects.            
  1860.      - Full line drawing procedures.                                       
  1861.      - Full cursor mode control for each window.                           
  1862.      - Writes in all text modes and column modes.                          
  1863.      - Only 13k bytes of code if all 69 utilities are used.                
  1864.      - Used in all other Eagle products.                                   
  1865.      - Excellent documentation like this document.
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.    Appendix D: Application Products                                    Page 31
  1872.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1873.  
  1874.  
  1875.    Here are the product versions:
  1876.  
  1877.       File name    CIS Name    Compiler  Release date
  1878.       -----------  ----------  --------  ------------
  1879.       WNDW42.ARC   WNDW42.ARC  TP4        10-15-88
  1880.       WNDW5X.ARC   WNDW5X.ARC  TP5        10-15-88
  1881.       WNDWC20.ARC  WNDC20.ARC  TC2        02-01-89
  1882.  
  1883.  
  1884.    PULL
  1885.  
  1886.    PULL - For multi-level pull-down menus, PULL is fully featured and fully 
  1887.    configurable.  Includes execute, single, and multiple choice menus, 
  1888.    unlimited nested submenus, data entry windows, help windows, directory 
  1889.    windows, message system, and fully completed interfaces.  Some of the 
  1890.    features are:
  1891.  
  1892.      - Uses QWIK and WNDW.
  1893.      - Work window(s) and complete interface for menus
  1894.      - Pull-down menus with 3 menu modes and 7 line modes
  1895.      - Pull-down file directory
  1896.      - Highlighted command letters
  1897.      - Unlimited levels of submenus
  1898.      - Unlimited data entry windows for 9 types of data
  1899.      - Data entry for the work window(s)
  1900.         Free field entry with either fixed column or flexible column        
  1901.          length.
  1902.         Full editing capability including insert cursor mode
  1903.         Full field selection with cursor keys
  1904.         Automatic NumLock for numerical data entry
  1905.         Right or left justification for data entry output
  1906.         Error messages for invalid data entries
  1907.         Error messages for data entries out of range
  1908.      - Automatic sizes and locations for menus.
  1909.      - Operation by cursor 
  1910.        keys or command keys
  1911.      - Pull/Pop between work window and nested submenu(s)
  1912.      - Programmable control of pull and pop sequences
  1913.      - Context-sensitive help
  1914.      - Message lines for prompts and processing
  1915.      - Full working shell for user development
  1916.      - Excellent documentation like this document.
  1917.  
  1918.    Here are the product versions:
  1919.  
  1920.       File name    CIS Name    Compiler  Release date
  1921.       -----------  ----------  --------  ------------
  1922.       PULL42.ARC   PULL42.ARC  TP4        01-03-89
  1923.       PULL5X.ARC   PULL5X.ARC  TP5        TBA
  1924.       PULLC20.ARC  PULC20.ARC  TC2        TBA
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.    Appendix D: Application Products                                    Page 32
  1933.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1934.  
  1935.  
  1936.    ON-LINE SERVICES
  1937.  
  1938.    CompuServe - All updated files and later versions can be found on the 
  1939.    CompuServe Borland Forums (GO BPROGA for TP and GO BPROGB for TC) or the 
  1940.    IBM Programming Forum (GO IBMPRO).
  1941.  
  1942. |  The Eagle BBS - After 01-10-89, you can also get the latest files on our 
  1943. |  24-hour BBS at (214) 539-9878, 300/1200 N81.
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.    Appendix D: Application Products                                    Page 33
  1994.    QWIK Screen Utilities                             User's Guide, Version 5.x
  1995.  
  1996.  
  1997.    A P P E N D I X   E :  R E V I S I O N   H I S T O R Y
  1998.  
  1999.  
  2000.    Pre-QWIK40 Versions - Here's a list of steps to help you upgrade to 
  2001.    QWIK42 from versions prior to QWIK40 on your programs:
  2002.  
  2003.      1. Add "Uses Qwik;"
  2004.      2. Delete the first Qinit.
  2005.      3. Do a search and replace for the following names.
  2006.           Search     Replace with
  2007.           ---------  ---------------------
  2008.           CardWait   CardSnow
  2009.           Qwait      Qsnow
  2010.           QwriteLV   QwriteA
  2011.           QwriteCV   QwriteC
  2012.           QwriteV    Qwrite
  2013.           ActiveDD   ActiveDispDev
  2014.           AltDD      AltDispDev
  2015.           PCCAltDD   AltDispDevPCC
  2016.           Vmode      VideoMode
  2017.      4. Add "CheckSnow:=Qsnow" early in the program and after each Qinit 
  2018.         if you use the CRT unit.
  2019.      5. See REVISIONS for changes of type.
  2020.  
  2021.    Version 4.0 (12-01-87):
  2022.      Converted QWIK30 to QWIK40 to work on Turbo Pascal 4.0.
  2023.      Deleted QwriteV and QwriteCV.
  2024.      Added WhereR and WhereC.
  2025.      Added Hercules and IBM 3270 PC detection.
  2026.      Renamed the following variables:
  2027.        From       To
  2028.        ---------- ------------
  2029.        CardWait   CardSnow
  2030.        Qwait      Qsnow
  2031.        QwriteLV   QwriteA
  2032.        QwriteCV   QwriteC
  2033.        QwriteV    Qwrite
  2034.        ActiveDD   ActiveDispDev
  2035.        AltDD      AltDispDev
  2036.        PCCAltDD   AltDispDevPCC
  2037.        Vmode      VideoMode
  2038.      Added the following variables:
  2039.        VideoPage, CRTcols, CRTrows, CardSeg, Have3270, 
  2040.        ActiveDispDev3270
  2041.      Added the following constants:
  2042.        NoHerc, HgcMono, HgcPlus, HercInColor
  2043.      Types were changed on the following items:
  2044.        - Strings passed to Qwrite* are of type String rather 
  2045.          than Str80.  (Should not be of any consequence.)
  2046.        - The CursorChange parameters are now word.
  2047.        - EgaFontSize, CRTcolumns, CardSeg, Page0seg, Qseg, 
  2048.              AltDispDevPCC and ArrayLength are now word.
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.    Appendix E: Revision History                                        Page 34
  2055.    QWIK Screen Utilities                             User's Guide, Version 5.x
  2056.  
  2057.  
  2058.    Version 4.1a (05-01-88):
  2059.      Added QwriteMore, QwriteMoreA, QfillMore, and QattrMore
  2060.        procedures.
  2061.      Added QnextOfs for the Q*More procedures.
  2062.      Improved video detection in Qinit for dual monitors, Hercules 
  2063.        cards, and system hardware detection.
  2064.      Included background color constants to use instead of an 
  2065.        attribute function.
  2066.      Reduced code size about 10%.
  2067.      Solved critical timing problem on IBM PC with CGA - at last!
  2068.      QWIK now uses the global variable CRTcols and not the absolute 
  2069.        variable CRTcolumns for offset calculations.
  2070.  
  2071.    Version 4.1b (06-18-88):
  2072.      Separated GetSubModelID out of Qinit as an optional procedure 
  2073.        due to BIOS bugs in PC/XT clones which would cause a lock up 
  2074.        at initialization.  New GetSubModelID now avoids those 
  2075.        machines and QWIK should now work on them.
  2076.  
  2077.    Version 4.2 (10-1-88):
  2078.      For clarity, the Q*More procedures were renamed to Q*Eos.
  2079.      Added the type VScrRecType.
  2080.      Added the following constants:
  2081.        CursorOff, CursorOn, CursorBlink,
  2082.      Added the following variables:
  2083.        QvideoPage, QvideoMode, QScrPtr, QScrRec,
  2084.        CursorInitial, CursorUnderline, CursorHalfBlock, CursorBlock
  2085.      Renamed the following variables for clarity:
  2086.        Qseg     -> QScrSeg
  2087.        Qofs     -> QScrOfs
  2088.        QnextOfs -> QEosOfs
  2089.      Added the following procedures and functions:
  2090.        QScrToVscr, QVscrToScr, QscrollUp, QscrollDown,
  2091.        QreadStr, QreadChar, QreadAttr,
  2092.        GotoEos, EosR, EosC, EosToRC, EosToRCrel, EosToCursor, EosLn,
  2093.        QEosLn
  2094.      Revamped the cursor procedures by deleting:
  2095.          CursorChange, CursorOn, CursorOff
  2096.        and replacing them with:
  2097.          SetCursor, GetCursor, ModCursor
  2098.      The screen base is now a FAR pointer using QScrOfs and QScrSeg     pieced 
  2099.        together to make QScrPtr to do virtual screens in RAM.
  2100.      GotoRC and WhereR/C now work on the "write" page instead of the viewed 
  2101.        page.
  2102.      Made FirstQinit a variable instead of constant so that it would be 
  2103.        initialized at each startup when executing in TP environment.  Hercules 
  2104.        cards are then tested at each startup.
  2105.      Completely revised documentation.
  2106.      Added supplementary STRS unit for string functions:
  2107.        StrL, StrLF, StrR, StrRF, StrRFD
  2108.  
  2109.    Version 4.2a (10-5-88):
  2110.      QattrC fixed.  (Did not exit properly when SameAttr used.)
  2111.  
  2112.  
  2113.  
  2114.  
  2115.    Appendix E: Revision History                                        Page 35
  2116.    QWIK Screen Utilities                             User's Guide, Version 5.x
  2117.  
  2118.  
  2119.    Version 4.2b (10-15-88):
  2120.      Identifiers StrLF, StrRF, and StrRFD incorrectly labled in STRS unit as 
  2121.        StrLW, StrRW, and StrRWD.  Document examples also corrected.
  2122.      Added intstructions for TP5 useage (registered users only).
  2123.  
  2124. |  Version 5.x (12-20-88):
  2125. |    Compiled QWIK42B under TP5.  No other changes.
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.    Appendix E: Revision History                                        Page 36
  2177.    QWIK Screen Utilities                             User's Guide, Version 5.x
  2178.  
  2179.  
  2180.    A P P E N D I X   F :  R E F E R E N C E S  A N D   C R E D I T S
  2181.  
  2182.  
  2183.   REFERENCES
  2184.  
  2185.    PS/2 Systems - For more information on the new IBM PS/2 system, you can 
  2186.    get the "Personal System/2 and Personal Computer BIOS Interface Technical 
  2187.    Reference" manual.  Other references include:
  2188.     
  2189.      IBM Personal System/2 Seminar Proceedings:
  2190.        Volume 5, Number 2, Displays and Adapters, publication 
  2191.          # G360-2678.
  2192.        Volume 5, Number 4, Models 50, 60, 80, VGA, BIOS and 
  2193.          Programming Considerations, publication # G360-2747.
  2194.  
  2195.    3270 PC - For more information on the IBM 3270 PC, you can get the 
  2196.    following publications:
  2197.  
  2198.      "3270 PC Application Development Considerations"
  2199.      "IBM 3270 Personal Computer Programming Guide", Pub # SA23-0221
  2200.      "IBM 3270 Personal Computer Control Program Reference", Pub
  2201.         # GA23-0232
  2202.  
  2203.    As always, the above information is subject to change without notice 
  2204.    per IBM.  
  2205.  
  2206.    Video Guide - An excellent guide for IBM and Hercules video card 
  2207.    programming in text and graphics is:
  2208.  
  2209.      "Programmer's Guide to PC & PS/2 Video Systems" by Richard Wilton and 
  2210.        published by Microsoft Press
  2211.  
  2212.    Trademarks - IBM is the trademark for International Business Machines 
  2213.    Corp.  Turbo Pascal is a trademark of Borland International.
  2214.  
  2215.  
  2216.    CREDITS
  2217.  
  2218.    Without the assistance and original ideas from Brian Foley, these 
  2219.    routines would not have been written.  And the helpful feedback from 
  2220.    users has inspired more powerful routines.
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.    Appendix F: References and Credits                                  Page 37
  2238.